package com.pp.order.controller;

import com.pp.api.order.OrderInfoService;
import com.pp.basedata.model.User;
import com.pp.basedata.service.UserService;
import com.pp.common.bean.ResultBuilder;
import com.pp.common.bean.ResultObject;
import com.pp.common.constant.enums.CoreMsg;
import com.pp.common.exception.BizException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class OrderInfoController implements OrderInfoService {

    @Autowired
    UserService userService;

    @Override
    public ResultObject<?> queryOrderInfo(@RequestBody Map map) {
        Integer id = (Integer)map.get("id");
        if(id==100){
            throw new BizException(CoreMsg.REQUEST_PARAMETER_ERROR);
        }
        User byId = userService.getById(id);
        return ResultBuilder.success(byId);
    }
}
